package com.core.zyyz.amc.modules.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.core.common.annotation.Log;
import com.core.common.core.controller.BaseController;
import com.core.common.core.domain.AjaxResult;
import com.core.common.enums.BusinessType;
import com.core.zyyz.amc.modules.domain.AmcSystemDimensionB;
import com.core.zyyz.amc.modules.service.AmcSystemDimensionBService;
import com.core.common.utils.poi.ExcelUtil;
import com.core.common.core.page.TableDataInfo;

/**
 * 维度定义Controller
 *
 * @author LiuFushun
 * @date 2024-11-05
 */
@RestController
@RequestMapping("/amc/function")
public class AmcSystemDimensionBController extends BaseController
{
    @Autowired
    private AmcSystemDimensionBService amcSystemDimensionBService;

    /**
     * 查询维度定义列表
     */
    @PreAuthorize("@ss.hasPermi('amc:function:list')")
    @GetMapping("/list")
    public TableDataInfo list(AmcSystemDimensionB amcSystemDimensionB)
    {
        startPage();
        List<AmcSystemDimensionB> list = amcSystemDimensionBService.selectAmcSystemDimensionBList(amcSystemDimensionB);
        return getDataTable(list);
    }

    /**
     * 获取维度定义详细信息
     */
    @PreAuthorize("@ss.hasPermi('amc:function:query')")
    @GetMapping(value = "/{dimensionId}")
    public AjaxResult getInfo(@PathVariable("dimensionId") String dimensionId)
    {
        return success(amcSystemDimensionBService.selectAmcSystemDimensionBByDimensionId(dimensionId));
    }

    /**
     * 新增维度定义
     */
    @PreAuthorize("@ss.hasPermi('amc:function:add')")
    @Log(title = "维度定义", businessType = BusinessType.INSERT)
    @PostMapping("/insertFunction")
    public AjaxResult add(@RequestBody AmcSystemDimensionB amcSystemDimensionB)
    {
        return toAjax(amcSystemDimensionBService.insertAmcSystemDimensionB(amcSystemDimensionB));
    }

    /**
     * 修改维度定义
     */
    @PreAuthorize("@ss.hasPermi('amc:function:edit')")
    @Log(title = "维度定义", businessType = BusinessType.UPDATE)
    @PostMapping("/updateFunction")
    public AjaxResult edit(@RequestBody AmcSystemDimensionB amcSystemDimensionB)
    {
        return toAjax(amcSystemDimensionBService.updateAmcSystemDimensionB(amcSystemDimensionB));
    }

    /**
     * 删除维度定义
     */
    @PreAuthorize("@ss.hasPermi('amc:function:remove')")
    @Log(title = "维度定义", businessType = BusinessType.DELETE)
    @PostMapping("/{dimensionIds}")
    public AjaxResult remove(@PathVariable String[] dimensionIds)
    {
        return toAjax(amcSystemDimensionBService.deleteAmcSystemDimensionBByDimensionIds(dimensionIds));
    }
}
